home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / portable / reset_pr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  1.9 KB  |  69 lines

  1. #include <string.h>
  2. #define    CURSES_LIBRARY    1
  3. #include <curses.h>
  4. #undef    reset_prog_mode
  5.  
  6. #ifdef PDCDEBUG
  7. char *rcsid_reset_pr = "$Header: C:\CURSES\portable\RCS\reset_pr.c 2.1 1993/06/18 20:20:56 MH Rel MH $";
  8. #endif
  9.  
  10. #ifndef UNIX
  11.  
  12. /*man-start*********************************************************************
  13.  
  14.   reset_prog_mode()    - restore terminal mode
  15.  
  16.   X/Open Description:
  17.      Restore the terminal to "program" (in curses) or "shell" (out
  18.      of curses) state.  These are done automatically by endwin()
  19.      and doupdate() after an endwin(), so they would normally not
  20.      be called before these functions.
  21.  
  22.   PDCurses Description:
  23.      Under the Flexos platform, PDCurses operates in 16-bit mode.
  24.      Normally, the Flexos shell operates in 8-bit mode.
  25.  
  26.   X/Open Return Value:
  27.      The reset_prog_mode() routine returns OK on success otherwise ERR
  28.      is returned.
  29.  
  30.   Portability:
  31.      PDCurses    int reset_prog_mode( void );
  32.      X/Open Dec '88    int reset_prog_mode( void );
  33.      SysV Curses    int reset_prog_mode( void );
  34.      BSD Curses    int reset_prog_mode( void );
  35.  
  36. **man-end**********************************************************************/
  37.  
  38. int    reset_prog_mode(void)
  39. {
  40. #ifdef PDCDEBUG
  41.     if (trace_on) PDC_debug("reset_prog_mode() - called\n");
  42. #endif
  43.  
  44.     if    (c_pr_tty.been_set == TRUE)
  45.     {
  46.  
  47.         memcpy(&_cursvar, &c_pr_tty.saved, sizeof(SCREEN));
  48.  
  49.         mvcur(0, 0, c_pr_tty.saved.cursrow, c_pr_tty.saved.curscol);
  50.         if (PDC_get_ctrl_break() != c_pr_tty.saved.orgcbr)
  51.             PDC_set_ctrl_break(c_pr_tty.saved.orgcbr);
  52.         if (c_pr_tty.saved.raw_out)
  53.             raw();
  54.         if (c_pr_tty.saved.visible_cursor)
  55.             curson();
  56.         _cursvar.font = PDC_get_font();
  57.         PDC_set_font(c_pr_tty.saved.font);
  58.         if (!PDC_scrn_modes_equal (PDC_get_scrn_mode(),  c_pr_tty.saved.scrnmode))
  59.             PDC_set_scrn_mode(c_pr_tty.saved.scrnmode);
  60.  
  61.         PDC_set_rows(c_pr_tty.saved.lines);
  62.     }
  63. #ifdef    FLEXOS
  64.     _flexos_16bitmode();
  65. #endif
  66.     return( OK );
  67. }
  68. #endif
  69.